<template>
  <div class="container">
    <!-- 幻灯片 -->
    <div class="carousel">
      <div class="searchTab_wrap"><SearchTab/></div>
      <el-carousel
        :interval="5000"
        arrow="always"
      >
        <el-carousel-item
          v-for="(item, index) in banners"
          :key="index"
        >
          <div
            class="banner-image"
            :style="`
                background:url(${$axios.defaults.baseURL+item.url}) center center no-repeat;
                background-size:contain contain;
                `"
          >
          </div>
        </el-carousel-item>
      </el-carousel>

 
    </div>

  </div>
</template>

<script>

export default {

  data() {
    return {
      // 轮播图数据
      banners: []
    };
  },
 async mounted () {
   const res = await this.$axios.get("/scenics/banners");
   this.banners = res.data;
  }
};
</script>

<style scoped lang="less">
.container {
  min-width: 1000px;
  margin: 0 auto;
  position: relative;

  /deep/ .el-carousel__container {
    height: 700px;
  }

  .banner-image {
    width: 100%;
    height: 100%;
  }
  .carousel{
    position: relative;
    .searchTab_wrap{
      position: absolute;
      top:50%;
      left: 50%;
      transform: translate(-50%,-50%);
      z-index: 1000;
    }
  }
}
</style>